//
//  BluetoothManager.h
//  Anyair
//
//  Created by karlcool on 14-5-18.
//  Copyright (c) 2014年 Karlcool. All rights reserved.
//

#import <Foundation/Foundation.h>

// type 0:PM 1:CO2 2:甲醛 3:温度 4:湿度 5:电量

@protocol BluetoothDelegate <NSObject>

- (void)dataDidUpdate:(NSString*)data WhichType:(int)type;

@end

@class BluetoothManager;

BluetoothManager *blManager;

@interface BluetoothManager : NSObject <BTSmartSensorDelegate> {
    
    int currentType;
    BOOL flag;
    NSTimer *PMTimer;
    NSMutableArray *pmArray;
    BOOL PMFlag;
    BOOL PMFlag1;
    BOOL PMFlag2;
    NSTimer *co2Timer;
}

+(BluetoothManager*)createManager;

@property (strong,nonatomic) SerialGATT *senor;
@property (strong,nonatomic) NSArray *headArray;
@property (weak,nonatomic) id<BluetoothDelegate> delegate;
@property (strong,nonatomic) NSMutableArray *resultArray;
@property (assign,nonatomic) BOOL isConnected;

- (void)connectDevice;//连接之前连接的设备

- (void)getPMData;//从硬件获取PM数值

- (void)getCO2Data;//从硬件获取CO2数值

- (void)getKeepCO2Data;

- (void)closeKeepCO2;

- (void)getMethanalData;//从硬件获取甲醛数值

- (void)getTemperatureData;//从硬件获取温度数值

- (void)getHumidityData;//从硬件获取湿度数值

- (void)getBatteryData;//从硬件获取电量

@end

